home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / harderr.zip / INT24.ASM < prev    next >
Assembly Source File  |  1991-10-06  |  2KB  |  103 lines

  1. ;Module Name : INT24.ASM
  2. ;Author      : Bill Buckels
  3. ;Date        : October 3, 1991
  4.  
  5. ;Purpose     : Hard Error ISR Function
  6. ;              for Large Model Microsoft C Version 5.1
  7. ;              Written in MASM version 5.1
  8. ;              From an Outline Generated By The MSC Compiler
  9.  
  10.  
  11. INT24_TEXT        SEGMENT  WORD PUBLIC 'CODE'
  12. INT24_TEXT        ENDS
  13.  
  14. _DATA    SEGMENT  WORD PUBLIC 'DATA'
  15. _DATA    ENDS
  16.  
  17. CONST    SEGMENT  WORD PUBLIC 'CONST'
  18. CONST    ENDS
  19.  
  20. _BSS    SEGMENT  WORD PUBLIC 'BSS'
  21. _BSS    ENDS
  22.  
  23. DGROUP    GROUP    CONST, _BSS, _DATA
  24.         ASSUME  CS: INT24_TEXT, DS: DGROUP, SS: DGROUP
  25.  
  26. EXTRN   _crit_error:BYTE
  27.  
  28. CONST      SEGMENT
  29.     CRIT_SEG DW SEG _crit_error
  30. CONST      ENDS
  31.  
  32. INT24_TEXT      SEGMENT
  33. ASSUME  CS: INT24_TEXT
  34.  
  35. ;logical value
  36. TRUE         =    1
  37.  
  38. ;offsets into our global hard error structure
  39. HARDSTATUS   =    0
  40. HERRNO       =    2
  41. DEVICE_SEG   =    4
  42. DEVICE_OFF   =    6
  43. IO_STATUS    =    8
  44.  
  45. ; action codes to return from the int24 ISR
  46. IGNORE_ERROR      = 0
  47. RETRY_OPERATION   = 1
  48. TERMINATE_PROGRAM = 2
  49. FAIL_SYSTEM_CALL  = 3
  50.  
  51. PUBLIC  _int24
  52.  
  53. _int24  PROC FAR
  54.         push    ax         ;save the registers
  55.     push    cx
  56.     push    dx
  57.     push    bx
  58.     push    sp
  59.     push    bp
  60.     push    si
  61.     push    di
  62.     push    ds
  63.     push    es
  64.  
  65.         mov     bx,bp      ;save bp in bx in case we have a driver error
  66.         mov     cx,si      ;save si in cx for the same reason
  67.         mov     dx,ax      ;save the error status in dx
  68.     mov    ax,DGROUP
  69.     mov    ds,ax
  70.     ASSUME DS: DGROUP
  71.         mov     ax,di      ;put the action code in ax
  72.     cld    
  73.  
  74.         ;--------------------------------------------------------
  75.         ;put the hard error information into a global structure
  76.         ;then resume the program.
  77.         ;--------------------------------------------------------
  78.         mov     es,CRIT_SEG
  79.         mov     WORD PTR es:_crit_error+HARDSTATUS,TRUE
  80.         mov     WORD PTR es:_crit_error+HERRNO,    ax
  81.         mov     WORD PTR es:_crit_error+DEVICE_SEG,bx
  82.         mov     WORD PTR es:_crit_error+DEVICE_OFF,cx
  83.         mov     BYTE PTR es:_crit_error+IO_STATUS, dh
  84.  
  85.     pop    es
  86.     pop    ds
  87.     ASSUME DS: DGROUP
  88.     pop    di
  89.     pop    si
  90.     pop    bp
  91.     pop    bx
  92.     pop    bx
  93.     pop    dx
  94.     pop    cx
  95.     pop    ax
  96.         mov     ax,IGNORE_ERROR
  97.     iret    
  98.  
  99. _int24    ENDP
  100.     nop    
  101. INT24_TEXT        ENDS
  102. END
  103.